/*
 * ActiveWindowsFactory.cpp
 *
 *  Created on: Nov 10, 2011
 *      Author: gonzalo
 */

#include "ActiveWindowsFactory.h"
#include "WindowHelper.h"
#include "../SDLtoolkit/SDLEngine.h"

Window* ActiveWindowsFactory::switchActiveWindow(Event& event,SDLEngine* engine){
	Window* aux = NULL;
	std::string screenTitle;
	WindowHelper helper;

	switch (event.getCode()) {
	case load:
		aux = helper.loadSceneWindow();
		engine->changeScreenTitle("BattleMaster3000: Inicio");
		engine->setNewVideoMode(LOAD_WIDTH_RESOLUTION, LOAD_HEIGHT_RESOLUTION);
		break;
	case edit:
		aux = helper.editSceneWindow(event.getData());
		screenTitle = "BattleMaster3000: Editar escenario [";
		screenTitle += event.getData();
		screenTitle += "]";
		event.eraseData();
		engine->changeScreenTitle(screenTitle);
		engine->setNewVideoMode(EDIT_WIDTH_RESOLUTION, EDIT_HEIGHT_RESOLUTION);
		break;
	case PLAY:
		aux = helper.playSceneWindow();
		engine->setNewVideoMode(PLAY_WIDTH_RESOLUTION, PLAY_HEIGHT_RESOLUTION);
		break;
	case PRINCIPAL:
		aux = helper.startGameWindow();
		engine->changeScreenTitle("BattleMaster3000: Start Game");
		engine->setNewVideoMode(START_WIDTH_RESOLUTION, START_HEIGHT_RESOLUTION);
		break;
	case connection:
		aux = helper.connectGameWindow();
		engine->changeScreenTitle("BattleMaster3000: Connection Game");
		engine->setNewVideoMode(CONNECTION_WIDTH_RESOLUTION, CONNECTION_HEIGHT_RESOLUTION);
		break;
	case EXIT:
		aux = helper.exitWindow();
		engine->changeScreenTitle("BattleMaster3000: Saliendo");
		engine->setNewVideoMode(EXIT_WIDTH_RESOLUTION, EXIT_HEIGHT_RESOLUTION);
		break;
	default:
		Logger::log("ActiveWindowsFactory", "switchActiveWindow","Se desecho un evento. Evento Desechado : " + event.getCode());
		break;
	}

	return aux;

}
